package Com.javaserver.servlet;

import Com.javaserver.bean.invite;
import Com.javaserver.dao.inviteserver;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/listX")
public class inviteLikeSelectserverlet  extends HttpServlet {
        inviteserver inlike=new inviteserver();

        @Override
        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
                doPost(req,resp);
        }

        @Override
        protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
                        String thename=req.getParameter("name");
                        invite theinvi=new invite();
                        theinvi.setC_name(thename);
                inviteserver invi = new inviteserver();
                if (!inlike.listX(theinvi)) {
                        req.getSession().setAttribute("msg", "删除失败");
                        resp.sendRedirect(req.getContextPath() + "/Department.jsp");
                } else {
                        List<invite> list = invi.inlist(1);
                        req.getSession().setAttribute("inlist", list);
                        req.getSession().setAttribute("nav", "招聘管理");
                        req.getSession().setAttribute("msg", "删除成功");
                        resp.sendRedirect(req.getContextPath() + "/Department.jsp");
                }
        }
}
